<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'bookdesc.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<meta http-equiv="content-type" content="text/html;charset=utf-8">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link rel="stylesheet" type="text/css" href="<c:url value='/adminjsps/admin/css/book/add.css'/>">
<link rel="stylesheet" type="text/css" href="<c:url value='/jquery/jquery.datepick.css'/>">
<script type="text/javascript" src="<c:url value='/jquery/jquery-1.5.1.js'/>"></script>
<script type="text/javascript" src="<c:url value='/jquery/jquery.datepick.js'/>"></script>
<script type="text/javascript" src="<c:url value='/jquery/jquery.datepick-zh-CN.js'/>"></script>
<script type="text/javascript">
$(function () {
	$("#publishtime").datepick({dateFormat:"yy-mm-dd"});
	$("#printtime").datepick({dateFormat:"yy-mm-dd"});
});

  //验证id
  function checkid(){
    var temp= document.getElementById("id");
	var partten = /^[0-9]+$/;
	if(temp.value!=""){
	if(!partten.test(temp.value)){
	alert('提示:请输入有效的id，只能是数字！');
	id.focus();
		return false ;
	}else{
		return false ;
	}
}
}
  
   //验证bookname
  function checkbookname(){
    var temp= document.getElementById("bname");
	var partten = /^[\u4E00-\u9FA5]+$/;
	if(temp.value!=""){
	if(!partten.test(temp.value)){
	alert('提示:请输入有效的bookname，只能是汉字！');
	bname.focus();
		return false ;
	}else{
		return false ;
	}
}
}
   
   //验证price
  function checkprice(){
    var temp= document.getElementById("price");
	var partten = /^[0-9]+$/;
	if(temp.value!=""){
	if(!partten.test(temp.value)){
	alert('提示:请输入有效的price，只能是整数！');
	price.focus();
		return false ;
	}else{
		return false ;
	}
}
}
   
   //验证author
  function checkauthor(){
    var temp= document.getElementById("author");
	var partten = /^[\u4E00-\u9FA5]+$/;
	if(temp.value!=""){
	if(!partten.test(temp.value)){
	alert('提示:请输入有效的姓名，只能是汉字！');
	author.focus();
		return false ;
	}else{
		return false ;
	}
}
}
      //验证press
  function checkpress(){
    var temp= document.getElementById("press");
	var partten = /^[\u4E00-\u9FA5]+$/;
	if(temp.value!=""){
	if(!partten.test(temp.value)){
	alert('提示:请输入有效的出版社，只能是汉字！');
	press.focus();
		return false ;
	}else{
		return false ;
	}
}
}
</script>
  </head>
  
  <body>
  <div>
   <p style="font-weight: 900; color: red;">${msg}</p>
   <form action="../Addserverle"  method="post" id="form">
    <div>
	    <ul>
	        <li>ID:　<input type="text" id="id" name="id" onblur="checkid();"></li>
	    	<li>书名：　<input id="bname" type="text" name="bname" onblur="checkbookname();" style="width:500px;"/></li>
	    	<li>大图：　<input id="image_w" type="file" name="image_w"/>(请将图片放入workspace/book_img/img下。图片大小为300*370)</li>
	    	<li>小图：　<input id="image_b" type="file" name="image_b"/>(请将图片放入workspace/book_img下。图片大小为200*230)</li>
	    	<li>当前价：<input id="price" type="text" name="price" onblur="checkprice();" style="width:50px;"/></li>
	    </ul>
		<hr style="margin-left: 50px; height: 1px; color: #dcdcdc"/>
		<table>
			<tr>
				<td colspan="3">
					作者：　　<input type="text" id="author" name="author" onblur="checkauthor();" style="width:150px;"/>
				</td>
			</tr>
			<tr>
				<td colspan="3">
					出版社：　<input type="text" name="press" id="press" onblur="checkpress();" style="width:200px;"/>
				</td>
			</tr>
			<tr>
				<td colspan="3">出版时间：<input type="text" id="publishtime" name="publishtime"  style="width:100px;"/></td>
			</tr>
			<tr>
				<td>
					一级分类：<select name="pid" id="pid" onchange="loadChildren()">
						<option value="1" selected='selected'>小说故事</option>
			    		<option value="2">学习资料</option>
			    		<option value="3">IT书籍</option>
					</select>
				</td>
				<td></td>
			</tr>
			<tr>
				<td>
					<input type="submit"  value="新书上架">
				</td>
				<td></td>
				<td></td>
			</tr>
		</table>
	</div>
   </form>
  </div>

  </body>
</html>
